package niuke;

import java.util.Scanner;

public class twentyfive {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            // 注意 hasNext 和 hasNextLine 的区别
             // 注意 while 处理多个 case
                int n = in.nextInt();
                int m = in.nextInt();
                int[] arr=new int[n+1];
                for(int i=1;i<=n;i++){
                    arr[i]=in.nextInt();
                }
                while (m>0){
                    int l=in.nextInt();
                    int r=in.nextInt();
                    for(int i=1;i<=n;i++){
                        int sum=(arr[l]+arr[r])*(r-l+1);
                        System.out.println(sum/2);
                        break;
                    }
                    m--;
                }
            }


}
